/**
 * App的视图
 */

import xs, { Stream } from 'xstream';
import { VNode } from '@cycle/dom';
import { AppState } from '../types';

/**
 * 视图
 * 使用jsx
 * @param state 
 */
export default function view(state$ : Stream<AppState>, todoListVDom$ : Stream<VNode>) : Stream<VNode> {
    return xs.combine(todoListVDom$)
        .map(([todoListVDom]) => 
            <div className='todoapp'>
                {todoListVDom}
                <footer className='info'>
                    <p>Double-click to edit a todo</p>
                    <p><a href='http://github.com/cyclejs/todomvc-cycle'>Source code</a></p>
                    <p>Created by <a href='http://andre.staltz.com'>Andre Staltz</a></p>
                </footer>
            </div>
        );
}